local duozhen = fk.CreateSkill{
  name = "wk_heg__duozhen",
}

Fk:loadTranslationTable{

  ["wk_heg__duozhen"] = "夺阵",
  [":wk_heg__duozhen"] = "当你对使用黑色牌对其他角色造成伤害后，你可以明置其一张牌或令其弃置一张明置牌；"..
    "有明置牌的其他势力角色不能响应你使用的牌。",

  ["#wk_heg__duozhen_choose"] = "夺阵：弃置一张 %dest 的明置牌或明置其一张暗置牌",
  ["~wk_heg__weichigong"] = "",
}

local H = require "packages/ol_hegemony/util"
local HG = require "packages/new_heg_diy_my/util"

duozhen:addEffect(fk.Damage, {
  can_trigger = function (self, event, target, player, data)
    return data.card.color == Card.Black and data.to ~= player and player:hasSkill(duozhen.name) and data.to:getHandcardNum() > 0
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local card = room:askToChooseCard(player, {
      target = data.to,
      flag = "h",
      skill_name = duozhen.name,
      prompt = "#wk_heg__duozhen_choose::"..data.to.id,
    })
    local hiddenCards = HG.getHiddenCards(data.to)
    if table.contains(hiddenCards, card) then
      HG.showCards(data.to, card)
    else
      room:throwCard(card, duozhen.name, data.to, player)
    end
  end 
})

duozhen:addEffect(fk.CardUsing, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(self.name) and table.find(player.room:getOtherPlayers(player, false), function (p)
      return #HG.getShownCards(p) > 0
    end)
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    data.disresponsiveList = data.disresponsiveList or {}
    table.insertTableIfNeed(data.disresponsiveList, table.filter(player.room:getOtherPlayers(player, false), function (p)
      return #HG.getShownCards(p) > 0
    end))
  end
})

return duozhen